1. Technical Field
The invention relates generally to a three-dimensional (3D) graphics processing method, and more particularly to a Z-culling method, a 3D graphics processing method using Z-culling and a 3D graphics processing apparatus thereof.
2. Related Art
Z-buffering techniques, also known as depth buffering or Z-testing, are used for managing the image depth coordinates in 3D graphics processing, in which parts of a rendered 3D scene are decided as visible, and other parts are decided as hidden.
For example, when a graphics processing unit (GPU) which supports a Z-buffering technique renders a 3D object in a 3D image, each processed pixel typically has a Z value representing the depth value of the 3D object on the screen. The Z values are stored into a corresponding location in a buffer referred to as a Z-buffer or a depth buffer. The Z-buffer is usually arranged as a two-dimensional (2D) array using the X value and Y value coordinates of the pixels, the 2D array being used for storing the depth value of each pixel. If another 3D object of the scene is rendered in the same pixel, then the graphics card compares the two depth values and keeps the object closer to the observer, saving the chosen pixel depth in the Z-buffer. The aforementioned Z-buffering technique may also be referring to as depth culling or Z-culling.
However, in the Z-buffering algorithm mentioned above, the pixel data of the 3D object and the depth values thereof must be first calculated. Moreover, no matter whether the observer is able to see the 3D object in the end or not, the pixel depths stored into the Z-buffer must be retrieved and compared with the calculated depth values of the pixel data. This process takes up an enormous bandwidth in the system memory. Oftentimes, the bandwidth between the system memory and the GPU is a major bottleneck affecting the graphics processing speed, especially in today's applications with 3D scenes having considerably high depth complexity. Therefore, effectively managing the memory traffic of the Z-buffer is imperative in 3D graphics processing techniques.
In order to reduce the number of access to the Z-buffer and to resolve the issues therein, a plurality of methods has been developed such as the coarse Z-culling technique. The coarse Z-culling technique rasterizes the screen and divides the screen into equal sized tiles. The 3D object is labeled, and a Z-culling buffer is established in the system memory so as to record attribute parameters such as the maximum depth value and the minimum depth value of the image in each tile. When a new 3D object is being processed, the coarse Z-culling technique determines whether the 3D object in the tiles has been covered by reading the attribute parameters in the system memory, so as to directly discard the covered part.
However, the current coarse Z-culling techniques often access the Z-culling buffer in the system memory during processing, and therefore a significant portion of the bandwidth is still taken up. In addition, during the computation process of the current coarse Z-culling techniques (e.g., confirming the relative depth positioning relationships), there are large and complex equations, complicated decisions, and a great quantity of value comparisons. Due to the need for simultaneous calculations of the equations in the algorithm, the hardware implementation becomes rather complex in view of the computational speed. Accordingly, in 3D graphics processing techniques, it is imperative to continually reduce the usage rate of the system memory bandwidth while lowering the computational complexity.